home *** CD-ROM | disk | FTP | other *** search
- /*
- File: MoreAEM.h
-
- Contains: C++ wrappers for the AppleEvent Manager
-
- Written by: Greg Anderson
-
- Copyright: © 1992-1996 by Apple Computer, Inc., all rights reserved.
-
- <23> 2/9/95 jtr
-
- */
-
- #ifndef MoreAEM_h
- #define MoreAEM_h
-
- #include <ConditionalMacros.h>
-
- //
- // Needed for AEDesc & c.
- //
- #include <AppleEvents.h>
- #include <AERegistry.h>
-
- //
- // For ProcessSerialNumber
- //
- #include <Processes.h>
-
- //
- // for TConstDataReference
- //
- #include "AbstractData.h"
-
- #if GENERATINGPOWERPC
- #pragma options align=mac68k
- #endif
-
- //
- // Old versions of Types.h use 'wide' instead of 'SInt64'
- // (the #ifndef doesn't seem to work, but the redefinition is okay;
- // I left the #ifndef in for clarity.)
- //
- #ifndef SInt64
- typedef wide SInt64;
- #endif
-
- //
- // Old versions of AppleEvents.h don't include typeSInt32 & c.
- //
- enum
- {
- typeSInt32 = 'long',
- typeUInt32 = 'magn',
- typeSInt64 = 'comp'
- };
-
- enum
- {
- typeTokenObject = 'tkob',
- typeTokenInHandle = 'thnd',
- typeDateTimeRec = 'dtim',
- typeLongDateTimeRec = 'ldtr'
- };
-
-
- //
- // We need to define these comparison operators
- // in order to allow us to reverse the order of
- // any two descriptors being compared
- //
- enum
- {
- kAEAtTheBeginningOf = 'atbg',
- kAEAtTheEndOf = 'aten',
- kAEIsContainedIn = 'isin'
- };
-
- //
- // Use with CreateList:
- //
- enum
- {
- kMakeAEList = false,
- kMakeAERecord = true
- };
-
- class TAETransaction;
-
- // Some procedural routines
-
- DescType ReverseComparisonOperator(DescType comparisonOperator);
- Boolean InterpretCompareResult(DescType comparisonOperator, SInt32 key1, SInt32 key2 );
- // Boolean GeneralCompare(DescType comparisonOperator, Ptr data, Size length, Ptr compareWith, Size comparisonLength, Boolean caseSensitive);
- Boolean CompareTypedData(DescType comparisonOperator, const TAbstractDataReference& compareThisRef, const TAbstractDataReference& compareWithRef);
- void InstallStringCompareBehavior();
-
-
- class TDescriptor;
- class TTokenDescriptor;
-
-
-
-
- //========================================================================================
- // CLASS TDescriptorDataReference
- //
- // If I just broke down and allowed TDescriptor to have a vtbl entry, then I could
- // make TDescriptor be derived from TAbstractDataReference, and do away with this
- // class completely. I'm holding out, but I'm not sure why.
- //========================================================================================
-
- class TDescriptorDataReference : public TAbstractDataReference
- {
- private:
- TDescriptor& fDescriptor;
-
- public:
- TDescriptorDataReference(TDescriptor& desc) : fDescriptor(desc) {}
-
- //
- // Data accessibility methods:
- //
- virtual Boolean DirectlyReadable() const;
- virtual Boolean Writable() const;
- virtual Boolean Resizable() const;
-
- //
- // Read-access methods:
- //
- virtual SInt32 DataType() const;
- virtual SInt32 DataLength() const;
- virtual SInt32 MaxLength() const;
-
- virtual SInt32 CopyTo(char* destination, SInt32 maxBytesToCopy) const;
-
- //
- // Write-access methods:
- //
- virtual Boolean CopyFrom(const TAbstractDataReference& source, Boolean allowDataToClip = false);
-
- //
- // Direct-access methods:
- //
- virtual const char* Data() const;
- };
-
-
-
-
- //========================================================================================
- // CLASS TDescriptor
- //========================================================================================
-
- class TDescriptor
- {
- protected:
- //
- // A TDescriptor is an AEDesc, so it must have
- // two and only two fields, and they must be
- // the descriptor type and the data handle.
- //
- #if 0
- DescType fDescriptorType;
- Handle fDataHandle;
- #endif
-
- AEDesc fAEDesc;
-
- //
- // These flags are passed to AEResolve when
- // specific flags are not specified. This
- // allows an application to define kAEIDoWhose
- // and/or kAEIDoMarking once at startup, and
- // subsequentially call AEResolve without
- // any parameters elsewhere in the code.
- //
- static SInt16 fCallbackFlags;
-
- public:
- static void SetCallbackFlags(SInt16 callbackFlags) { fCallbackFlags = callbackFlags; }
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Construction methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TDescriptor() { this->ClearDescriptor(); }
- TDescriptor(const AEDesc& desc) : fAEDesc(desc) {}
- TDescriptor(const TDescriptor& desc) : fAEDesc(desc) {}
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Conversion operators
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- operator const AEDesc*() const { return &fAEDesc; }
- operator AEDesc*() { return &fAEDesc; }
- operator AEDesc() const { return fAEDesc; }
-
- #if 0
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Construction methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TDescriptor() : fDescriptorType(typeNull), fDataHandle(nil) {}
- TDescriptor(DescType type, Handle dataHandle) : fDescriptorType(type), fDataHandle(dataHandle) {}
- TDescriptor(const TDescriptor& desc) : fDescriptorType(desc.DescriptorType()), fDataHandle(desc.DataHandle()) {}
- TDescriptor(AEDesc& desc) : fDescriptorType(desc.descriptorType), fDataHandle(desc.dataHandle) {}
- TDescriptor(AEDesc* desc) : fDescriptorType(desc->descriptorType), fDataHandle(desc->dataHandle) {}
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Conversion operators
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- operator const AEDesc*() const { return (const AEDesc*) this; }
- operator AEDesc*() { return (AEDesc*) this; }
- operator AEDesc() { return *((AEDesc*) this); }
-
- #endif
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Descriptor memory management:
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void Dispose();
- TDescriptor Clone() const;
- void AdoptDescriptor(TDescriptor& desc);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Simple information about the contents of a descriptor
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- //
- // Avoid using 'DataHandle' and 'DataHandleIsNil'
- //
- Handle DataHandle() const { return fAEDesc.dataHandle; }
- Boolean DataHandleIsNil() const { return this->DataHandle() == nil; }
-
- DescType DescriptorType() const { return fAEDesc.descriptorType; }
- SInt32 DataSize() const { return this->DataHandle() ? GetHandleSize(this->DataHandle()) : 0; }
- void ClearDescriptor() { fAEDesc.descriptorType = typeNull; fAEDesc.dataHandle = nil; };
-
- operator const TDescriptorDataReference() const { return TDescriptorDataReference(*((TDescriptor*)this)); }
- operator TDescriptorDataReference() { return TDescriptorDataReference(*this); }
-
- Boolean IsNullDescriptor() const { return (this->DescriptorType() == typeNull); }
-
- Boolean Compare(DescType comparisonOperator, const TDescriptor& compareWith) const;
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Canonical get and set data accessors
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void GetDescriptorData(TUpdataDataReference& buffer, DescType typeToCoerceTo = typeWildCard) const;
- void SetDescriptorData(const TAbstractDataReference& data, DescType typeToCoerceTo = typeWildCard);
- void SetDescriptorData(const TDescriptor& data);
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Data coercion
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TDescriptor AttemptToCoerce(DescType typeToCoerceTo, OSErr& err) const;
- TDescriptor Coerce(DescType typeToCoerceTo) const;
-
- //
- // Avoid coerce-in-place unless you know what you're doing.
- //
- // One time where it is best to use CoerceInPlace is when you
- // have just created an AERecord, and you need to coerce the
- // result to some other record type (e.g. typeObjectSpecifier).
- //
- // One time where it is very bad to do a coerce in place is
- // when you need to change the data type of a descriptor passed
- // to you by some peice of code that still has a reference to
- // the descriptor--for example, any of the descriptors passed
- // to your code by the object support library.
- //
- OSErr AttemptCoerceInPlace(DescType typeToCoerceTo);
- void CoerceInPlace(DescType typeToCoerceTo);
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: A multitude of ways to get descriptor data
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- Boolean GetBooleanData() const;
- SInt32 GetSInt32Data() const;
- UInt32 GetUInt32Data() const;
- SInt64 GetSInt64Data() const;
-
- DescType GetDescTypeData(DescType expectedType = typeType) const;
-
- ProcessSerialNumber GetPSNData() const;
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: A multitude of ways to set descriptor data
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void SetBooleanData(const Boolean& data);
- void SetSInt32Data(const SInt32& data);
- void SetUInt32Data(const UInt32& data);
- void SetSInt64Data(const SInt64& data);
-
- void SetDescTypeData(const SInt32& data, DescType dataType = typeType);
-
- void SetPSNData(const ProcessSerialNumber& psn);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: List methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void CreateList(Boolean isRecord = kMakeAEList, Ptr factoringPtr = nil, Size factoredSize = 0);
- void CoerceToList();
-
- UInt32 CountItems() const;
- TDescriptor GetNthItem(SInt32 index, DescType desiredType = typeWildCard, AEKeyword* key = nil) const;
- void GetNthItemData(SInt32 index, TUpdataDataReference& buffer, DescType desiredType = typeWildCard, AEKeyword* key = nil) const;
-
- void AddItemToList(SInt32 index, const TDescriptor& data);
- void AddItemToList(const TDescriptor& data);
- void AddItemToList(SInt32 index, const TAbstractDataReference& data);
- void AddItemToList(const TAbstractDataReference& data);
-
- void AppendList(const TDescriptor& list);
- void AppendListAndDispose(TDescriptor& list);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Record methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void MakeAERecord();
-
- TDescriptor GetDescriptorParameter(AEKeyword key, DescType desiredType = typeWildCard) const;
- void GetParameterData(AEKeyword key, TUpdataDataReference& buffer, DescType desiredType = typeWildCard) const;
- Boolean GetBooleanParameter(AEKeyword key) const;
- SInt32 GetSInt32Parameter(AEKeyword key) const;
- UInt32 GetUInt32Parameter(AEKeyword key) const;
- SInt64 GetSInt64Parameter(AEKeyword key) const;
- DescType GetDescTypeParameter(AEKeyword key, DescType expectedType = typeType) const;
- ProcessSerialNumber GetPSNParameter(AEKeyword key) const;
-
- TDescriptor GetOptionalParameter(AEKeyword key, DescType desiredType = typeWildCard) const;
- void GetOptionalParameterData(AEKeyword key, TUpdataDataReference& buffer, DescType desiredType = typeWildCard) const;
- SInt32 GetOptionalSInt32Parameter(AEKeyword key, SInt32 defaultValue = 0) const;
-
- void PutDescriptorParameter(AEKeyword key, const TDescriptor& data);
- void PutParameterData(AEKeyword key, const TAbstractDataReference& data);
- void PutBooleanParameter(AEKeyword key, const Boolean& data);
- void PutSInt32Parameter(AEKeyword key, const SInt32& data);
- void PutUInt32Parameter(AEKeyword key, const UInt32& data);
- void PutSInt64Parameter(AEKeyword key, const SInt64& data);
- void PutDescTypeParameter(AEKeyword key, const SInt32& data, DescType dataType = typeType);
- void PutPSNParameter(AEKeyword key, const ProcessSerialNumber& psn);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Object specifier methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void GetObjectSpecifierParameters(DescType& desiredClass, DescType& keyForm, TDescriptor* keyData = nil, TDescriptor* containerDesc = nil) const;
-
- void MakeObjectSpecifier(DescType desiredClass, TDescriptor& container, DescType keyForm, TDescriptor keyData, Boolean disposeInputs);
- void MakeObjectSpecifierForProperty(DescType property, TDescriptor& container, Boolean disposeInputs);
- void SetDescriptorDataTypeObjectBeingExamined();
- void MakeSpecifierForPropertyOfObjectBeingExamined(DescType propertyIdentifier);
- void MakeCompDescriptor(DescType comparisonOperator, TDescriptor& comparitor, TDescriptor& compareWith, Boolean disposeInputs);
- void MakeCompDescriptor(DescType comparisonOperator, DescType propertyIdentifier, TDescriptor& compareWith, Boolean disposeInputs);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Object support library
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TTokenDescriptor Resolve(const TAETransaction&, TDescriptor* objectThatCausedError = nil) const;
- TTokenDescriptor Resolve(const TAETransaction&, SInt16 callbackFlags, TDescriptor* objectThatCausedError = nil) const;
-
- static pascal OSErr GetErrorDesc(TDescriptor** errorDescriptor);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Old TDescriptor methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TDescriptor CoerceToStandardType() const;
- SInt16 Lock() const;
- void Unlock(SInt16 oldState) const;
-
- };
-
-
- //========================================================================================
- // CLASS TAEvent
- //========================================================================================
-
- class TAEvent : public TDescriptor
- {
- public:
-
- //
- // Conversion opperators
- //
- operator const AppleEvent*() const { return (const AppleEvent*) this; }
- operator AppleEvent*() { return (AppleEvent*) this; }
- operator AppleEvent() { return *((AppleEvent*) this); }
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Event creation
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void MakeAppleEvent(AEEventClass eventClass, AEEventID eventID,
- const AEAddressDesc *target, SInt16 returnID = kAutoGenerateReturnID, SInt32 transactionID = kAnyTransactionID);
- void MakeAppleEvent(AEEventClass eventClass, AEEventID eventID,
- const ProcessSerialNumber& psn, SInt16 returnID = kAutoGenerateReturnID, SInt32 transactionID = kAnyTransactionID);
-
- void MakeEventAddressedToSelf(AEEventClass eventClass, AEEventID eventID, SInt16 returnID = kAutoGenerateReturnID, SInt32 transactionID = kAnyTransactionID);
- void MakeEventAddressedToSystem(AEEventClass eventClass, AEEventID eventID, SInt16 returnID = kAutoGenerateReturnID, SInt32 transactionID = kAnyTransactionID);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Attribute access
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- TDescriptor GetDescriptorAttribute(AEKeyword key, DescType desiredType = typeWildCard) const;
- void GetAttributeData(AEKeyword key, TUpdataDataReference& buffer, DescType desiredType = typeWildCard) const;
- Boolean GetBooleanAttribute(AEKeyword key) const;
- SInt32 GetSInt32Attribute(AEKeyword key) const;
- UInt32 GetUInt32Attribute(AEKeyword key) const;
- SInt64 GetSInt64Attribute(AEKeyword key) const;
- DescType GetDescTypeAttribute(AEKeyword key, DescType expectedType = typeType) const;
- ProcessSerialNumber GetPSNAttribute(AEKeyword key) const;
-
- TDescriptor GetOptionalAttribute(AEKeyword key, DescType desiredType = typeWildCard) const;
- void GetOptionalAttributeData(AEKeyword key, TUpdataDataReference& buffer, DescType desiredType = typeWildCard) const;
- SInt32 GetOptionalSInt32Attribute(AEKeyword key, SInt32 defaultValue = 0) const;
-
- void PutDescriptorAttribute(AEKeyword key, const TDescriptor& data);
- void PutAttributeData(AEKeyword key, const TAbstractDataReference& data);
- void PutBooleanAttribute(AEKeyword key, const Boolean& data);
- void PutSInt32Attribute(AEKeyword key, const SInt32& data);
- void PutUInt32Attribute(AEKeyword key, const UInt32& data);
- void PutSInt64Attribute(AEKeyword key, const SInt64& data);
- void PutDescTypeAttribute(AEKeyword key, const SInt32& data, DescType dataType = typeType);
- void PutPSNAttribute(AEKeyword key, const ProcessSerialNumber& psn);
-
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Special descriptor access
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- SInt32 GetReturnID() const { return this->GetSInt32Attribute(keyReturnIDAttr); }
- SInt32 GetMessageTimeout() const { return this->GetSInt32Attribute(keyTimeoutAttr); }
- SInt32 GetTransactionID() const { return this->GetOptionalSInt32Attribute(keyTransactionIDAttr); }
-
- void PutOptionalDescriptorParameter(AEKeyword key, const TDescriptor& data);
- void PutOptionalParameterData(AEKeyword key, const TAbstractDataReference& data);
- void PutResult(const TDescriptor& data);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Special-use methods
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- Boolean CanInteractWithUser() const;
- void ResetTimer();
- void SpecifyThatParameterIsOptional(AEKeyword theOptionalKeyword);
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: Send and receive
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void Send(TAEvent* reply, AESendMode sendMode, AESendPriority sendPriority = kAENormalPriority,
- SInt32 timeOutInTicks = kAEDefaultTimeout, AEIdleUPP idleProc = nil, AEFilterUPP filterProc = nil);
- void Send(TAEvent* future) { this->Send(future, kAEWaitReply); }
- void SendNoExecute();
- void SuspendTheCurrentEvent();
- void ResumeTheCurrentEvent(TAEvent* reply, AEEventHandlerUPP dispatcher = nil, SInt32 refCon = 0);
- void SetTheCurrentEvent();
-
- void SendNoReply();
- };
-
-
- //========================================================================================
- // CLASS TDescriptorIterator
- //========================================================================================
-
- class TDescriptorIterator
- {
- public:
- TDescriptorIterator(const TDescriptor& descriptorList) :
- fDescriptorList(descriptorList),
- fCurrentIndex(1),
- fCachedCount(0),
- fIterateBackwards(false) { fCachedCount = descriptorList.CountItems(); fCurrent.ClearDescriptor(); this->Reset(); }
- ~TDescriptorIterator();
-
- void Reset(Boolean iterateBackwards = false);
- Boolean More() const;
- void Next();
- TDescriptor Current() const;
- TDescriptor OrphanCurrent();
- AEKeyword CurrentKeyword() const;
-
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- //:: A slew of ways to get data without copying out a descriptor
- //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-
- void GetCurrentItemData(TUpdataDataReference& buffer, DescType desiredType = typeWildCard, AEKeyword* key = nil) const;
-
- Boolean GetCurrentBooleanData() const;
- SInt32 GetCurrentSInt32Data() const;
- UInt32 GetCurrentUInt32Data() const;
- SInt64 GetCurrentSInt64Data() const;
- DescType GetCurrentDescTypeData(DescType expectedType = typeType) const;
-
- private:
- const TDescriptor& fDescriptorList;
- TDescriptor fCurrent;
- SInt32 fCurrentIndex;
- UInt32 fCachedCount;
- Boolean fIterateBackwards;
- };
-
-
-
- //========================================================================================
- // CLASS TAETransaction
- //
- // The class TAETransaction is used to represent an AppleEvent single-message
- // transaction--that is to say, an AppleEvent and its corresponding reply.
- //
- // TAETransaction also has facilities for caching a transaction pointer;
- // TransactionSuite.cp/h uses this to avoid looking up the transaction object
- // every time it is requested (TransactionSuite.cp provides support for multiple-event
- // transactions).
- //========================================================================================
-
- class TAETransaction
- {
- public:
- TAETransaction() :
- fAEvent(), fReply(), fTransaction(nil) {}
- TAETransaction(TAEvent& event) :
- fAEvent(event), fReply(), fTransaction(nil) {}
- TAETransaction(TAEvent& event, TAEvent& reply) :
- fAEvent(event), fReply(reply), fTransaction(nil) {}
-
- Boolean HasMessage() const { return fAEvent.IsNullDescriptor() == false; }
- Boolean HasReply() const { return fReply.IsNullDescriptor() == false; }
-
- TAEvent Message() const { return fAEvent; }
- TAEvent Reply() const { return fReply; }
-
- SInt32 GetTransactionID() const { return HasMessage() ? fAEvent.GetTransactionID() : 0; }
-
- void* TransactionCache() const { return fTransaction; }
- void SetTransactionCache(void* t) { fTransaction = t; }
-
- private:
- TAEvent fAEvent;
- TAEvent fReply;
- void* fTransaction;
- };
-
-
- //
- // MoreAEM doesn't know anything about TAbstractScriptableObject
- // other than the fact that a class with that name exists.
- //
- class TAbstractScriptableObject;
-
- typedef TTokenDescriptor (*MakeTokenDescriptorProcPtr)();
- typedef TTokenDescriptor (*ProcessDescriptorProcPtr)(const TAETransaction&, TDescriptor descToResolve, TDescriptor* objectThatCausedError);
- typedef TAbstractScriptableObject* (*MergeTokensProcPtr)(TAbstractScriptableObject* baseToken, TAbstractScriptableObject* mergeToken);
-
- void InstallNullContainerCreationProc(MakeTokenDescriptorProcPtr creationProc);
- void InstallPreResolveProc(ProcessDescriptorProcPtr preResolveProc);
- void InstallMergeTokensProc(MergeTokensProcPtr mergeTokensProc);
-
- TTokenDescriptor CreateNullContainerToken();
-
-
- //========================================================================================
- // CLASS TTokenDescriptor
- //========================================================================================
-
- class TTokenDescriptor : public TDescriptor
- {
- public:
- TTokenDescriptor() {}
- TTokenDescriptor(const TDescriptor& desc) : TDescriptor(desc) {}
-
- // destructor & disposer
- void DisposeToken();
-
- TAbstractScriptableObject* TokenObject();
-
- void AdoptToken(TTokenDescriptor& tokenDescriptor);
- void AdoptToken(TAbstractScriptableObject* tokenObject);
-
- };
-
-
-
-
- #if 0
-
- //
- // A descriptor loop iterates over every item in a descriptor
- // list or an AERecord.
- //
- class TDescriptorLoop
- {
- public:
- TDescriptorLoop(const TDescriptor* dl) {fDescriptorList = dl; fIndex = 0; fCount = 0; }
- Boolean Next(TDescriptor& d, AEKeyword* key = nil);
-
- private:
- const TDescriptor* fDescriptorList;
- SInt32 fIndex;
- SInt32 fCount;
- };
-
- #define FOREACHDESCRIPTOR(listToIterate, descriptor) \
- TDescriptorLoop loop(listToIterate); \
- AEKeyword keyword; \
- while (loop.Next(descriptor, &keyword))
-
- #endif
-
-
- #if GENERATINGPOWERPC
- #pragma options align=reset
- #endif
-
-
- #endif